public class testBase64 {
	public static void main(String[] args) throws java.io.IOException {
		if (args[0].equals("0")) {
			sun.misc.BASE64Encoder base64_encoder = new sun.misc.BASE64Encoder();
			System.out.println(base64_encoder.encode(args[1].getBytes()));
		} else {
			sun.misc.BASE64Decoder base64_decoder = new sun.misc.BASE64Decoder();
			System.out.println(new String(base64_decoder.decodeBuffer(args[1])));
		}
	}
}
